aes() ไนไธญggplot(df, aes()) +
geom_xxx()geom_point()geom_line()geom_histogram()geom_boxplot()geom_bar()install.packages(c("tidyverse", "gapminder"))library(tidyverse)
library(gapminder)gapminder_2007 <- gapminder %>%
filter(year == 2007)
scatter <- ggplot(gapminder_2007, aes(x = gdpPercap, y = lifeExp)) +
geom_point() +
theme_minimal()scatternorth_asia <- gapminder %>%
filter(country %in% c("China", "Japan", "Taiwan", "Korea, Rep."))
line_plot <- ggplot(north_asia, aes(x = year, y = gdpPercap, colour = country)) +
geom_line() +
theme_minimal()line_plothistogram <- ggplot(gapminder_2007, aes(x = gdpPercap)) +
geom_histogram(bins = 20) +
theme_minimal()histogrambox_plot <- ggplot(gapminder_2007, aes(x = continent, y = gdpPercap)) +
geom_boxplot() +
theme_minimal()box_plotgdpPercap_2007_na <- gapminder %>%
filter(year == 2007 & country %in% c("China", "Japan", "Taiwan", "Korea, Rep."))
bar_plot <- ggplot(gdpPercap_2007_na, aes(x = country, y = gdpPercap)) +
geom_bar(stat = "identity") +
theme_minimal()bar_plotinstall.packages("readxl")
library(readxl)
hh <- read_excel("YOUR_EXCEL_PATH")